package vip.xiaonuo.smzq.modular.psba.controller;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.psba.entity.PsbaGtBg;
import vip.xiaonuo.smzq.modular.psba.entity.vo.PsbaGtBgDetailVO;
import vip.xiaonuo.smzq.modular.psba.service.IPsbaGtBgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 评审备案报告情况
 *
 * @author Kevin
 * @since 2024-05-15
 */
@Api(tags = "评审备案报告情况")
@RestController
@RequestMapping("/psba/psbaGtBg")
@Validated
public class PsbaGtBgController {

    @Resource
    private IPsbaGtBgService iPsbaGtBgService;

    /**
     * 添加评审备案报告情况
     */
    @ApiOperation("添加评审备案报告情况")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid PsbaGtBg psbaGtBg) {
        iPsbaGtBgService.save(psbaGtBg);
        return CommonResult.ok();
    }

    /**
     * 删除评审备案报告情况
     */
    @ApiOperation("删除评审备案报告情况")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iPsbaGtBgService.removeById(pkid);
        return CommonResult.ok();
    }




    /**
     * 编辑评审备案报告情况
     */
    @ApiOperation("编辑评审备案报告情况")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid PsbaGtBg psbaGtBg) {
        iPsbaGtBgService.updateById(psbaGtBg);
        return CommonResult.ok();
    }

    /**
     * 评审备案报告情况分页查询
     */
    @ApiOperation("评审备案报告情况分页查询")
    @GetMapping("/list")
    public CommonResult<Page<PsbaGtBg>> page(
            @ApiParam(name = "current", value = "页数", example = "1", required = true)  @RequestParam long current,
            @ApiParam(name = "size", value = "每页数量", example = "20", required = true) @RequestParam long size
    ) {
        return CommonResult.data(iPsbaGtBgService.page(current,size));
    }

    /**
     * 评审备案报告详情
     */
    @ApiOperation("评审备案报告详情")
    @GetMapping("/detail")
    public CommonResult<PsbaGtBgDetailVO> detail(@ApiParam(name = "psbabh", value = "评审备案编号", required = true) @RequestParam String psbabh) {
        return CommonResult.data(iPsbaGtBgService.detail(psbabh));
    }
    /**
     * 获取审备案报告情况详情
     */
    @ApiOperation("获取审备案报告情况详情")
    @GetMapping("/getPsbaGtBg")
    public CommonResult<PsbaGtBg> getPsbaGtBg(
            @ApiParam(name = "psbabh", value = "评审备案编号") @RequestParam String psbabh
    ) {


        return CommonResult.data(iPsbaGtBgService.getPsbaGtBg(psbabh));
    }
}
